<template>
  <div>
    <el-tabs type="border-card">
      <el-tab-pane label="考试详情">
        <div>
          <div>
            <el-alert
                title="基本信息"
                type="success"
                :closable="false">
            </el-alert>
          </div>
          <div>
<!--            <el-table size="small" :data="listData1" highlight-current-row  border  style="width: 100%;">-->
<!--              <el-table-column width="1058">-->
                <el-descriptions title="" :column="2" border >
                  <el-descriptions-item label="考试名称" label-class-name="my-label" content-class-name="my-content" width="50">{{name}}</el-descriptions-item>
                  <el-descriptions-item label="考试时间" >{{time1}}</el-descriptions-item>
                  <el-descriptions-item label="参加限制" >{{time2}}</el-descriptions-item>
                  <el-descriptions-item label="答题时间" :contentStyle="{'text-align': 'left'}" >{{time3}}</el-descriptions-item>
                  <el-descriptions-item label="交卷限制" >{{time4}}</el-descriptions-item>
                  <el-descriptions-item label="考试说明" >常规考试</el-descriptions-item>
                  <el-descriptions-item label="考试提醒" >
                      开启
                    </el-descriptions-item>
                  <el-descriptions-item label="提醒时间" >{{time5}}</el-descriptions-item>
                  <el-descriptions-item label="考生须知" >服从考试安排</el-descriptions-item>
                </el-descriptions>
<!--              </el-table-column>-->
<!--            </el-table>-->
          </div>

        </div><br><br>

        <div>
          <div>
            <el-alert
                title="试卷信息"
                type="success"
                :closable="false">
            </el-alert>
          </div>
          <div>
<!--            <el-table size="small" :data="listData1" highlight-current-row border  style="width: 100%;" >-->
<!--              <el-table-column width="1058">-->
                <el-descriptions title="" :column="2" border >
                  <el-descriptions-item label="选择试卷"  label-class-name="my-label" content-class-name="my-content" width="50">{{examxz2}}</el-descriptions-item>
                  <el-descriptions-item label="选择难度" >{{examDifficulty}}</el-descriptions-item>
                  <el-descriptions-item label="试题排序" >固定排序</el-descriptions-item>
                  <el-descriptions-item label="选项排序"  :contentStyle="{'text-align': 'left'}" >选项排序</el-descriptions-item>
                  <el-descriptions-item label="合格分数" >{{passLine}}</el-descriptions-item>
                </el-descriptions>
<!--              </el-table-column>-->
<!--            </el-table>-->
          </div>

        </div><br><br>

<!--        <div>-->
<!--          <div>-->
<!--            <el-alert-->
<!--                title="考生信息"-->
<!--                type="success"-->
<!--                :closable="false">-->
<!--            </el-alert>-->
<!--          </div><br><br>-->

<!--          &lt;!&ndash;列表&ndash;&gt;-->
<!--          <el-table size="small" :data="listData" highlight-current-row border element-loading-text="拼命加载中" style="width: 100%;">-->
<!--            <el-table-column align="center" type="selection" width="60">-->
<!--            </el-table-column>-->
<!--            <el-table-column sortable prop="id" label="序号" width="200">-->
<!--            </el-table-column>-->
<!--            <el-table-column sortable prop="account" label="姓名" width="200">-->
<!--            </el-table-column>-->
<!--            <el-table-column sortable prop="password" label="证件号" width="200">-->
<!--            </el-table-column>-->
<!--            <el-table-column sortable prop="status" label="性别" width="200">-->
<!--            </el-table-column>-->
<!--            <el-table-column sortable prop="phone" label="联系电话" width="200">-->
<!--            </el-table-column>-->
<!--          </el-table>-->
<!--        </div>-->

        <!--        <div class="falutHand">-->
        <!--          <examcard-->
        <!--            v-for="item in falutHand"-->
        <!--            :key="item.id"-->
        <!--            :examContent="item"-->
        <!--            v-show="!showShade"-->
        <!--          ></examcard>-->
        <!--          <paper v-show="showShade"></paper>-->
        <!--        </div>-->
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
import examcard from "@c/examCard";
import paper from "@c/paper";

export default {
  created() {
    let id = this.$route.query.id
    console.log(name)
    this.getdata(id)




  },

  methods: {

    getdata(id) {
      // this.loading = true

      this.$axios.post('http://localhost:8080/examAdministration/selectById/' + id
      ).then(
          res => {
            console.log("Exam对象后端数据》查询", res)
            console.log("Exam对象后端数据", res.data.data)
            // this.listData = res.data.data
            this.name =res.data.data.examName
            this.time1 = res.data.data.examQuizTime
            this.time2 = res.data.data.referenceAstrictTime
            this.time3 = res.data.data.answerTime
            this.time4 = res.data.data.presentationTime
            this.time5 = res.data.data.remindTime
            this.examDifficulty = res.data.data.examDifficulty
            this.passLine = res.data.data.passLine
            this.examxz = res.data.data.paperId


            // this.pageparm.currentPage = res.data.data.pageNum;
            // this.pageparm.pageSize = res.data.data.pageSize
            //初始化分页组件显示的总页数
            console.log("Exam对象后端数据》查询", res)
            console.log("Exam对象后端数据", res.data.data.total)
            this.handleCurrentChange.total = res.data.data.total

            this.$axios.post('http://localhost:8080/testPaper/findById/' +this.examxz).then(
                res => {
                  console.log(res)
                  this.examxz2 = res.data.data.name

                }
            ).catch()
          })
    },

    // 新增考试按钮用
    addRoutes1 () {
      this.$router.push('/exam/index')
    },

    //分页用
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
    }
  },

  name: "index",
  components: {
    examcard,
    paper,
  },
  data() {

    return {
      //渲染详情页每个字段用
      name:null,
      time1:null,
      time2:null,
      time3:null,
      time4:null,
      time5:null,
      examDifficulty:null,
      passLine:null,
      examxz:null,
      examxz2:null,

      //排序用
      radio: '1',
      radio1: '3',

      //基本信息用
      listData1: [{
        a:'aaa',
        b:'bbb'
      }],

      //试卷信息用
      listData2: [{

      }],

      listData: [
          // {
      //   id: '1',
      //   account: '王小虎',
      //   password: '11111111111111111',
      //   phone:15555555555,
      //   status:'男'
      // }, {
      //   date: '2016-05-04',
      //   name: '王小虎',
      //   address: '上海市普陀区金沙江路 1517 弄'
      // }, {
      //   date: '2016-05-01',
      //   name: '王小虎',
      //   address: '上海市普陀区金沙江路 1519 弄'
      // }, {
      //   date: '2016-05-03',
      //   name: '王小虎',
      //   address: '上海市普陀区金沙江路 1516 弄'
      // }
      ],

      // timeFreq: [
      //   { title: "章节1", time: "2020年5月23日16:33:56", dura: "60min"  },
      //   { title: "章节2", time: "2020年5月23日16:33:56", dura: "60min" },
      //   { title: "章节3", time: "2020年5月23日16:33:56", dura: "60min" },
      //   { title: "章节4", time: "2020年5月23日16:33:56", dura: "60min" },
      //   { title: "章节5", time: "2020年5月23日16:33:56", dura: "60min" },
      // ],
      dutyRule: [
        { title: "章节331", time: "2020年5月23日16:33:56", dura: "60min" },
        { title: "章节212", time: "2020年5月23日16:33:56", dura: "60min" },
        { title: "章节3", time: "2020年5月23日16:33:56", dura: "60min" },
      ],
      falutHand: [
        { title: "章节1", time: "2020年5月23日16:33:56", dura: "60min" },
        { title: "章节25", time: "2020年5月23日16:33:56", dura: "60min" },
        { title: "章节3", time: "2020年5月23日16:33:56", dura: "60min" },
      ],

      // 导入事件
      search() {
        console.log('formInline',this.formInline);
        console.log('this.pageparm',this.pageparm);
        this.formInline.page = this.pageparm.currentPage;
        this.formInline.limit = this.pageparm.pageSize;
        this.getdata()
      },
      //显示编辑界面
      handleEdit: function(index, row) {
        this.editFormVisible = true
        if (row != undefined && row != 'undefined') {
          this.title = '修改'
          this.editForm.id = row.id;
          this.editForm.account = row.account
          this.editForm.password = row.password
          this.editForm.status = row.status
        } else {
          this.title = '添加'
          this.editForm.id = ''
          this.editForm.account = ''
          this.editForm.password = ''
          // this.editForm.status = ''
        }
      },

      currentPage1: 5,
      currentPage2: 5,
      currentPage3: 5,
      currentPage4: 4

    };
  },
  computed: {
    showShade() {
      return this.$store.state.settings.onShade;
    },
  },
};
</script>

<style scoped lang="scss">
.timeFreq {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
}
.dutyRule {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
}
.falutHand {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
}
</style>
